from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from chromeDriver import driver

driver.get("http://127.0.0.1/upload/message.php")
# 输入留言内容---是一个文本域，特殊标记是textarea
driver.find_element_by_tag_name("textarea").send_keys("hello")
# 输入留言内容
driver.find_element(By.TAG_NAME, "textarea").send_keys("123")
# 输入留言内容
driver.find_element_by_xpath("//textarea").send_keys("456")
# 输入留言内容
driver.find_element(By.XPATH, "//textarea").send_keys("789")
sleep(8)
# 点击整个网页左上角的“ECSHOP”的商标---回到首页
driver.find_element(By.TAG_NAME, "img").click()
# 点击登录
driver.find_element(By.XPATH, "//font/a[1]/img").click()
sleep(1)
# 点击注册 ---练习！
driver.find_element(By.XPATH, "//font/a[2]/img").click()
sleep(3)
# 点击高级搜索
driver.find_element(By.XPATH, "//form/a").click()
sleep(2)
# 点击留言板
driver.find_element(By.XPATH, "//a[10]").click()
sleep(2)
# 点击投诉的单选按钮
driver.find_element(By.XPATH, "//tr[3]/td[2]/input[2]").click()
# 输入电子邮件地址111@222.com
driver.find_element(By.XPATH, "//input[@name='user_email']").send_keys("111@222.com")
# 点击售后单选按钮
driver.find_element(By.XPATH, "//input[@value='3']").click()
# 点击左上角ECSHOP商标---回到首页
driver.find_element(By.XPATH, "//a[@name='top']/img").click()
# 点击登录
driver.find_element(By.XPATH, "//a[@href='user.php']/img").click()
sleep(3)
driver.quit()
